﻿using MediatR;
using SystemHYS.API.Application.command.GualityGroupCommand;
using SystemHYS.Infrstructre.Interface;
namespace SystemHYS.API.Application.commandler.GualityGroupCommandler
{
    public class GualityGroupDeleteCommandler : IRequestHandler<GualityGroupDeleteCommand, int>
    {
        IGualityGroupRepository GroupRepository;
        public GualityGroupDeleteCommandler(IGualityGroupRepository GroupRepository)
        {
            this.GroupRepository = GroupRepository;
        }
        public async Task<int> Handle(GualityGroupDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await GroupRepository.GetModelAsnc(request.gualityGroupId);
            list.IsDel = true;
            list.DelectTime = DateTime.Now.ToUniversalTime();
            list.DelectName = "李明";
            return await GroupRepository.UpdateAsyn(list);
        }
    }
}
